package April._26.homework.work3;

import java.lang.reflect.Field;

public class Main implements Test{
    @Config
    String wuliao=null;

    public static void main(String[] args) throws ClassNotFoundException {
        //获取字节码文件
        Class<?> aClass = Class.forName("April._26.homework.work3.Main");
        //获取成员对象
        //注意此处没有获取父类接口的成员
        Field[] declaredFields = aClass.getDeclaredFields();
        for (Field declaredField : declaredFields) {
            boolean annotationPresent = declaredField.isAnnotationPresent(Config.class);
            if(annotationPresent){
                Config annotation = declaredField.getAnnotation(Config.class);
                String value = annotation.value();
                System.out.println(declaredField+"  有Config注解、value 值为 "+value);
            }
        }

    }

}
